#include <config.h>
#include "Delay1.h"
sbit P2_2 = P2^2;//3L
sbit P2_3 = P2^3;//2L
sbit P2_4 = P2^4;//1L

sbit P2_5 = P2^5;//1H
sbit P2_6 = P2^6;//2h
sbit P2_7 = P2^7;//3h
unsigned char mkey()
{
	unsigned char x=0;
//	P2=0xFF;
	P2_4=0;
	if(P2_7==0){Delay1(20);while(P2_7==0);Delay1(20);x=1;}
	if(P2_6==0){Delay1(20);while(P2_6==0);Delay1(20);x=4;}
	if(P2_5==0){Delay1(20);while(P2_5==0);Delay1(20);x=7;}
	//if(P1_4==0){Delay(20);while(P1_4==0);Delay(20);x=13;}

//		P2=0xFF;
	P2_3=0;
	if(P2_7==0){Delay1(20);while(P2_7==0);Delay1(20);x=2;}
	if(P2_6==0){Delay1(20);while(P2_6==0);Delay1(20);x=5;}
	if(P2_5==0){Delay1(20);while(P2_5==0);Delay1(20);x=8;}
	//if(P1_4==0){Delay(20);while(P1_4==0);Delay(20);x=14;}

//		P2=0xFF;
	P2_2=0;
	if(P2_7==0){Delay1(20);while(P2_7==0);Delay1(20);x=3;}
	if(P2_6==0){Delay1(20);while(P2_6==0);Delay1(20);x=6;}
	if(P2_5==0){Delay1(20);while(P2_5==0);Delay1(20);x=9;}
	//if(P1_4==0){Delay(20);while(P1_4==0);Delay(20);x=15;}

	return x;
}
